package myicesscheduler.web;

import static org.junit.Assert.*;

import java.io.File;

import org.junit.BeforeClass;
import org.junit.Test;

public class AdminBackupCompressControllerTest
{
   @BeforeClass
   static public void beforeClass()
   {
      final String delim = String.valueOf( File.separatorChar );

      System.setProperty( MyFolderUtil.uploadFolder_folderPropertyName, "." + delim + "WebContent"
            + delim + "WEB-INF" + delim + "upload" );

      System.setProperty( MyFolderUtil.backupFolder_folderPropertyName, "." + delim + "WebContent"
            + delim + "WEB-INF" + delim + "backup" );
   }

   @Test
   public void Assumptions()
   {
      final String parentOfUploadFolder = new File( MyFolderUtil.uploadFolder.getAbsolutePath() )
            .getParent();
      final String parentOfDatabaseFolder = new File( MyFolderUtil.databaseFolder.getAbsolutePath() )
            .getParent();
      assertEquals( parentOfUploadFolder, parentOfDatabaseFolder );
   }

   @Test
   public void getFilesToCompress()
   {
      final String[] zipFiles = AdminBackupCompressController.compress();
      assertEquals( 2, zipFiles.length );
   }

}
